/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package EJB;

import DAO.Personne;
import DAO.Post_Message;
import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Mathias
 */
@Stateful
public class PersonneEJB implements PersonneEJBLocal {
    
    @PersistenceContext(name = "AnnuaireEJB-ejbPU")
    private EntityManager em;
    
    @Override
    public void save(Personne p)
    {
        em.persist(em.merge(p));
    }

    @Override
    public void update(Personne p)
    {
        em.merge(p);
    }

    @Override
    public void delete(Personne p)
    {
        p = em.merge(p);
        em.remove(p);
    }

    @Override
    public void posterMessage(String message) {
    }

    @Override
    public void posterCommentaire(Post_Message msg, String commentaire) {
    }
    
}
